import { Component, OnInit, Input } from '@angular/core';
import {importExpr} from '@angular/compiler/src/output/output_ast';
import {HttpClient} from '@angular/common/http';

declare var Swiper: any;


@Component({
  selector: 'app-lunbo1',
  templateUrl: './lunbo1.component.html',
  styleUrls: ['./lunbo1.component.scss']
})
export class Lunbo1Component implements OnInit {
  public img: any
 public png: any[] = [
    {
      url: '../../assets/img/u1283.jpg'
    },
    {
      url: '../../assets/img/u1296.png'
    },
    {
      url: '../../assets/img/u1309.png'
    },
    {
      url: '../../assets/img/u1322.jpg'
    },
    {
      url: '../../assets/img/u1335.jpg'
    },
  ]
  constructor( public http: HttpClient) {

  }

  ngOnInit( ) {
    setTimeout( () => {
        const mySwiper = new Swiper ('.swiper-container', {
          direction: 'horizontal', // 垂直切换选项
          loop: true, // 循环模式选项

          // 如果需要分页器
          pagination: {
            el: '.swiper-pagination',
            // bulletClass : 'my-bullet',
            bulletActiveClass: 'my-bullet-active',
          },
          autoplay: {
            disableOnInteraction: false,
          },
          // // 如果需要前进后退按钮
          // navigation: {
          //   nextEl: '.swiper-button-next',
          //   prevEl: '.swiper-button-prev',
          // },

          // 如果需要滚动条
          // scrollbar: {
          //   el: '.swiper-scrollbar',
          // },
      }
    );
    }, 100);

    const api = 'http://192.168.2.227:8080/rotation/list';
    this.http.get(api).subscribe((respnse: any) => {
      console.log(respnse);
      this.png = respnse.data.list;
      console.log(this.png);
    });
  }
}
